package com.leetcode.dfs;

import java.util.ArrayList;
import java.util.List;

public class Subsets {
    public static void main(String[] args) {

    }

    List<List<Integer>> resList = new ArrayList<>();

    public List<List<Integer>> subsets(int[] nums) {
        dfs(nums, new ArrayList<>(), 0);
        return resList;
    }

    public void dfs(int[] nums, List<Integer> tmpList, int curInd) {
        if (curInd == nums.length) {
            resList.add(new ArrayList<>(tmpList));
            return;
        }
        tmpList.add(nums[curInd]);
        dfs(nums, tmpList, curInd+1);
        tmpList.remove(tmpList.size() - 1);
        dfs(nums, tmpList, curInd+1);
    }
}
